package com.jinlia.show.modules.base.system.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jinlia.show.common.core.entity.BaseEntity;
import com.jinlia.show.modules.base.config.DynamicSchemaConfig;
import com.jinlia.show.modules.base.constant.MemberCardBalanceChangeEnum;
import com.jinlia.show.modules.base.constant.OrderPayStatusEnum;
import com.jinlia.show.modules.base.constant.i.IBaseEnum;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 会员卡余额变动记录
 */
@Data
@TableName(value = "erp_member_card_balance_change", schema = DynamicSchemaConfig.schema_system)
public class MemberCardBalanceChange extends BaseEntity {
    @TableId()
    private Long id;
    /**
     * 会员卡id
     */
    private Long memberCardId;

    /**
     * 见 MemberCardBalanceChangeEnum
     * 来源类型:1:充值，2：消费，3：期初入库,4:管理员调整
     */
    private Integer changeEnum;
    @TableField(exist = false)
    private String changeEnumName;

    /**
     * 来源对象ID
     */
    private Long changeObjectId;

    /**
     * 本次变动金额，可为负数
     */
    private BigDecimal moneyChange;

    /**
     * 剩余金额
     */
    private BigDecimal availableBalance;
    /**
     * 会员池的可用余额
     */
    private BigDecimal availableBalancePool;

    /**
     * 备注
     */
    private String remark;

    public void setChangeEnum(Integer changeEnum) {
        this.changeEnum = changeEnum;
        this.changeEnumName = IBaseEnum.getLabelByValue(changeEnum, MemberCardBalanceChangeEnum.class);
    }
}
